<div id="main">
    <div id="contents_stat">
        <form method="post" action="#" name="filters">
            <fieldset>
                <legend>
                    <label sid=" wrom_statistics.memory"></label>
                </legend>
                <div class="frame_tab_layer">
                    <table class="cmenutitle" cellspacing="0" cellpadding="0" border="0" width="100%">
                        <tbody>
                        <tr>
                            <td class="frame_tab_left">
                                <label sid="wrom_statistics.memory_total"></label>
                            </td>
                            <td id="memory_total" class="frame_tab_right"></td>
                        </tr>
                        <tr>
                            <td class="frame_tab_left">
                                <label sid="wrom_statistics.memory_left"></label>
                            </td>
                            <td id="memory_left" class="frame_tab_right"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </fieldset>
            <fieldset>
                <legend>
                    <label sid=" wrom_statistics.wan"></label>
                </legend>
                <div class="frame_tab_layer">
                    <table class="cmenutitle" cellspacing="0" cellpadding="0" border="0" width="100%">
                        <tbody>
                        <tr>
                            <th>
                                <label sid=" wrom_statistics.td1"></label>
                            </th>
                            <th>
                                <label sid=" wrom_statistics.td2"></label>
                            </th>
                            <th>
                                <label sid=" wrom_statistics.td3"></label>
                            </th>
                            <th>
                                <label sid=" wrom_statistics.td4"></label>
                            </th>
                            <th>
                                <label sid=" wrom_statistics.td5"></label>
                            </th>
                        </tr>
                        <tr>
                            <td>
                                <label sid=" wrom_statistics.wan"></label>
                            </td>
                            <td id="wan_rx_pakage"></td>
                            <td id="wan_rx_byte"></td>
                            <td id="wan_tx_pakage"></td>
                            <td id="wan_tx_byte"></td>
                        </tr>
                        <tr>
                            <td>
                                <label sid=" wrom_statistics.lan"></label>
                            </td>
                            <td id="lan_rx_pakage"></td>
                            <td id="lan_rx_byte"></td>
                            <td id="lan_tx_pakage"></td>
                            <td id="lan_tx_byte"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </fieldset>
            <fieldset>
                <legend>
                    <label sid=" wrom_statistics.all_interface"></label>
                </legend>
                <div class="frame_tab_layer">
                    <table id="wrom_statistics" class="cmenutitle" cellspacing="0" cellpadding="0" border="0" width="100%"> </table>
                </div>
            </fieldset>
        </form>
    </div>
</div>
<script type="text/javascript" src="js/libTable.js"></script>
<script type="text/javascript">
	var virtual_data = new Array();
	load_html();
	function load_html(){
		DataRequest("/cgi-bin/stat?netstat","",function(data){
		var memery = data["meminfo"].split(",");
		$("#memory_total").html(memery[0]+" KB");
		$("#memory_left").html(memery[1] + " KB");
		var wan = data["wan"].split(",");
		$("#wan_rx_pakage").html(wan[1]);
		$("#wan_rx_byte").html(wan[2]);
		$("#wan_tx_pakage").html(wan[3]);
		$("#wan_tx_byte").html(wan[4]);
		var lan = data["lan"].split(",");
		$("#lan_rx_pakage").html(lan[1]);
		$("#lan_rx_byte").html(lan[2]);
		$("#lan_tx_pakage").html(lan[3]);
		$("#lan_tx_byte").html(lan[4]);
		var tmparray = strToJSON(data["all"]);
		virtual_data = tmparray;
		virtual_paint_list(tmparray);
	});
	}
	
	function virtual_paint_list(data){
 	var data_new=new Array();
 	var j=0;
  for(var i=0;i<data.length;i++){
 	var names = data[i][0];
 	var rx_pakage=data[i][1];
 	var rx_byte=data[i][2];
 	var tx_pakage=data[i][3];
 	var tx_byte=data[i][4];
 	
  data_new.push({names:names,rx_pakage:rx_pakage,rx_byte:rx_byte,tx_pakage:tx_pakage,tx_byte:tx_byte});
  j = i;
 }
 var fun_arr = {};
 var tab = new libTable(new Array(wrom_statistics.td1,wrom_statistics.td2,wrom_statistics.td3,wrom_statistics.td4,wrom_statistics.td5),data_new,1,10);
 print_table("wrom_statistics",tab,fun_arr, true);
}

    function loadData(){
       var flag = $("#wrom_statistics_main_load").hasClass("current");
        if(flag){
        load_html()
        }else{
            clearInterval(tt);
        }
    }

 var tt = setInterval( "loadData()",5000);
</script>
